
function request() {
    let request = getHttpObject();
   if(request) {
    request.open("GET","example.txt",true);
    request.onreadystatechange = function() {
       if(request.readyState == 4) {
           let gallery = document.getElementById("gallery")
           let para = document.createElement("p");
           let txt = document.createTextNode(request.responseText);
           gallery.appendChild(para);
           para.appendChild(txt);
       }
    }
    request.send(null);
   } else {
       alert("sorry your browser does'nt support XMLrequest")
   }
    
}
function getHttpObject() {
    return new XMLHttpRequest();
}